const express = require('express')
const session = require('express-session')
const config = require("./config")
const app = express()
const bodyParser = require('body-parser')
const Authentication = require("./Middleware/Authentication")
const router = require("./router/index")
app.use(bodyParser.json()) // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
app.use(express.static('./state'))
app.use(session({
    secret: '!@#!@#ASDASDkjasdh.13215',
    cookie: {
        maxAge: 60000 * 60 * 24,
        //  有效期 关闭浏览下次再进入 只要cookie还在 就可以正常进入
    }
}))

// app.use(Authentication)


app.use(router)


app.listen(config.prot, () => {
    console.log("服务器启动成功");
})